#include "PO_MoM.h"
#include "FillMatrix.h"
#include <iostream>
using namespace blitz;

void FillV()
{
	V.resize(iWire);
	for (int m=0; m<iWire; m++)
		V(m) = 1.0/(2*Eta*dComplex(0.0,1.0))*sin(WaveNumber*abs(dot(vWire(m),Position3D(0,0,1))));
}
void FillZ()
{
	Z.resize(iWire,iWire);
	for (int m=0; m<iWire; m++)
		for (int n=0; n<iWire; n++)
		{
			if (0 == n) Z(m,n) = cos(WaveNumber*dot(vWire(m),Position3D(0,0,1)));
			else if (iWire-1 == n) Z(m,n) = sin(WaveNumber*dot(vWire(m),Position3D(0,0,1)));
			else Z(m,n) = dComplex(cos(-WaveNumber*GetR(m,n)),sin(-WaveNumber*GetR(m,n)))/(4*PI*GetR(m,n))*DeltaLength;
		}
}

double GetR(int m,int n)
{
	return sqrt(dot(vWire(m)-vWire(n),vWire(m)-vWire(n))+WireRadius*WireRadius);
}